package com.slz3.business.module.memberManagement.memAppKey.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.memberManagement.memAppKey.domain.MemAppKey;
import com.slz3.business.module.memberManagement.memAppKey.domain.MemAppKeyFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MemAppKeyTransactionalServiceImpl implements MemAppKeyTransactionalService {

    @Override
    public MemAppKey modify(MemAppKey memAppKeyNew) {
        Repositorys.memAppKey.test();
        Repositorys.memAppKey.save(MemAppKeyFactory.initBaseFields());
        System.err.println(1/0);
        memAppKeyNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.memAppKey.saveAndFlush(memAppKeyNew);
    }

    @Override
    public List<MemAppKey> batchModify(List<MemAppKey> memAppKeyList) {
        return Repositorys.memAppKey.saveAll(memAppKeyList);
    }
}
